package com.ruoyi.system.mapper.admin;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.constant.CommonConstant;
import com.ruoyi.common.core.domain.entity.admin.AdminCropDB;
import org.apache.commons.lang3.ObjectUtils;

public interface AdminCropVarietiesMapper extends BaseMapper<AdminCropDB> {

    default boolean checkIsActive(Long id) {
        LambdaQueryWrapper<AdminCropDB> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(AdminCropDB::getId, id);
        queryWrapper.eq(AdminCropDB::getIsActive, CommonConstant.CONSTANT_NUM.ONE);

        return ObjectUtils.isNotEmpty(this.selectOne(queryWrapper));

    }
}
